#ifndef __CM_MEDIA_MEDIA_TASK_H__
#define __CM_MEDIA_MEDIA_TASK_H__

#include "Common.h"
#include "Poco/Runnable.h"
#include "Poco/Thread.h"
#include "Poco/PriorityNotificationQueue.h"
#include "cm_base/ByteBuffer.h"

using namespace Poco;
using namespace cm_base;

namespace cm_media
{
    
    class MediaTask: public Runnable
    {
    public:
        MediaTask();
        virtual ~MediaTask();

        void start();

        int enqueueNotification( BaseNotification* p_n, int priority );
        Notification * waitDequeueNotification( long milliseconds );

        virtual int enqueueBuffer(ByteBuffer* p_buffer) = 0;

    protected:
        virtual void run() = 0;

    protected:
        PriorityNotificationQueue m_notifiacations;
        Thread m_thread;

    };
}

#endif